<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>打印销售出库单内容</title>
    <%= stylesheet_link_tag "/stylesheets/print.css" %>
    <style type="text/css">
      .table{border-collapse:collapse; font-size:13px; height:24px; line-height:24px;}
      .table tr td{border:solid 1px;}
    </style>
  </head>
  <body>
    <table width="700" class="table">
      <thead>
        <tr>
          <td width="35" style="text-align:center">序号</td>
          <td width="200" style="text-align:center">商品名称</td>
          <td width="100" style="text-align:center">商品编号</td>
          <td width="35" style="text-align:center">单位</td>
          <td width="40" style="text-align:center">数量</td>
          <td width="75" style="text-align:center">单价</td>
          <td width="85" style="text-align:center">金额</td>
        </tr>
      </thead>
      <% currentAmount = 0
      i = 1
    %>
      <%@saleReturnedDetails.each do |saleReturnedDetail|%>
        <tr>
          <td>&nbsp;<%=i%></td>
          <td>&nbsp;<%=saleReturnedDetail.product.name%></td>
          <td>&nbsp;<%=saleReturnedDetail.product.number%></td>
          <td>&nbsp;<%=saleReturnedDetail.product.unit%>&nbsp;</td>
          <td><div align="right"><%=saleReturnedDetail.quantity%>&nbsp;</div> </td>
          <td>
            <div align="right"><%if params[:sub_type] == '2'%><%=  number_with_delimiter( '%.6f' % (saleReturnedDetail.unit_price * saleReturnedDetail.discount))%>&nbsp;
              <%end%></div>
          </td>
          <td>
            <div align="right"><%if params[:sub_type] == '2'%><%=   number_with_delimiter( '%.6f' % (saleReturnedDetail.unit_price * saleReturnedDetail.discount * saleReturnedDetail.quantity ))%>&nbsp;
                <% currentAmount += saleReturnedDetail.unit_price * saleReturnedDetail.discount * saleReturnedDetail.quantity  %><%end%></div>
          </td>
        </tr>
        <% i = i+1
      end%>
      <tr>
        <td> </td>
        <td> </td>
        <td> </td>
        <td>总计:</td>
        <td> <div align="right"><%=@totalQuantity%>&nbsp;</div></td>
        <td> </td>
        <td><div align="right"><%if params[:sub_type] == '2'%><%=  number_with_delimiter( '%.3f' % currentAmount) %>&nbsp;<%end%></div></td>
      </tr>
    </table>
  </body>
</html>